﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NLog;
using DAL;
using System.Web.Services;
using Entity;

public partial class Admin_UserComments : ParentPage
{
    #region variables
    private static Logger _logger = LogManager.GetCurrentClassLogger();
    #endregion

    #region pageload
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                UserCommnets objUserCommnets = new UserCommnets();
                rptManageUserComments.DataSource = objUserCommnets.GetComment();
                rptManageUserComments.DataBind();
            }
        }
        catch (Exception ex)
        {
            _logger.Error("Admin_UserComments:::Page_Load:::" + ex.Message);
        }
    }
    #endregion

    #region Events
    protected void lbtnRefreshGV_Click(object sender, EventArgs e)
    {
        try
        {
        }
        catch (Exception ex)
        {
            // _logger.Error("Admin_UserComments:::lbtnRefreshGV_Click:::" + ex.Message);
        }
    }

    #endregion

    #region WebMethods

    [WebMethod]
    public static string UserCommentsManagment(string sCommentID, string sFlag)
    {
        try
        {
            UserCommnets objUserCommnets = new UserCommnets();
            UsersComments objEntityUsersComments = new UsersComments();
            if (sFlag == "1")
            {
                objEntityUsersComments.CommentID = Convert.ToInt32(sCommentID);
                objUserCommnets.ApproveComment(objEntityUsersComments);
                return "true";
            }
            else
            {
                objEntityUsersComments.CommentID = Convert.ToInt32(sCommentID);
                objUserCommnets.RejectedComment(objEntityUsersComments);
                return "true";
            }
        }
        catch (Exception ex)
        {
            _logger.Error("Admin_UserComments:::DeleteArticlesInfo:::" + ex.Message);
            return "false";
        }
    }
    #endregion
}